// Every Picture In The Universe 0.1
// Started by Vander 'imerso' Nunes on July 2012
// To contact me: imerso@imersiva.com
//
// Given enough time, generates every possible
// image for a given resolution -- which includes all your
// pictures in the past, present and future, plus
// you playing guitar together with David Gilmour
// on Rock in Rio, etc.
// OK, that may take a few billion years depending
// on the selected image resolution, but hey,
// one day that will happen -- hmm well, I guess.
//
// license: http://opensource.org/licenses/lgpl-2.1
//
// Although it seems like the program is just
// randomizing pixels, this is definitely not
// the case. A linear loop is too boring,
// so I'm trying to create alternative ways
// of permute color combinations in more
// interesting ways. Some may be buggy at
// first, but eventually this will combine
// using interesting, dynamic patterns
// until something meaninful happens.
//
// Hope you get the idea.
//
// most obvious enhancements:
//
// - a start dialog to select options
// - mono and grayscale support (for way faster permutations)
// - a time control to skip directly to a given time
// - pause the simulation
// - save both the 'time' and the generated image.

#ifndef _SW_SCREEN_H_
	#define _SW_SCREEN_H_

	#include <ddraw.h>

	class CScreen
	{
		private:

			// directdraw object for fullscreen switching
			// its used only when fullscreen mode is selected,
			// otherwise it remains NULL.
			LPDIRECTDRAW	m_pDDraw;

			WORD					m_wWidth, m_wHeight, m_wDepth;
			WORD					m_wWinWidth, m_wWinHeight;
			bool					m_bFullScreen;
			HWND					m_hWnd;

			// off-screen frame-buffer description
			BITMAPINFO		m_Info;
			HBITMAP			m_hBmOff;
			HDC				m_hDcOff;
			// off-screen frame-buffer
			BYTE*					m_pFrameBuffer;
			// Z-Buffer
			BYTE*					m_pZBuffer;

		public:

			CScreen();
			virtual				~CScreen();

			bool					Init(WNDPROC pWndProc, WORD wWidth=320, WORD wHeight=240, WORD wDepth=32, bool bFullScreen=false, HWND hParent=HWND_DESKTOP, WORD wWinWidth=640, WORD wWinHeight=480, char *szScrTitle="S3DE");

			void					Flip();

			BYTE*					FrameBuffer()	{ return m_pFrameBuffer; };
			BYTE*					ZBuffer()			{ return m_pZBuffer; };
			WORD					Width()				{ return m_wWidth; };
			WORD					Height()			{ return m_wHeight; };

			HWND					hWnd()				{ return m_hWnd; };
	};

#endif
